package com.pactera.madp.daemon.quartz.task;

import com.pactera.madp.common.core.constant.SecurityConstants;
import com.pactera.madp.cp.api.feign.RemoteSensitiveWordsMonitorWorkService;
import com.pactera.madp.cp.api.feign.RemoteSensitiveWordsService;
import com.pactera.madp.daemon.quartz.constant.enums.MadpQuartzEnum;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * SensitiveWordsMonitorTask
 *
 * @author jun
 * @version 1.0
 * 2021/8/18 15:05
 **/
@Slf4j
@Component("sensitiveWordsMonitorTask")
@AllArgsConstructor
public class SensitiveWordsMonitorTask {

    private final RemoteSensitiveWordsMonitorWorkService sensitiveWordsMonitorService;

    private final RemoteSensitiveWordsService remoteSensitiveWordsService;

    /**
     * 敏感词监控信息同步
     * @return
     */
    @SneakyThrows
    public String autoSensitiveWords(){
        sensitiveWordsMonitorService.autoSensitiveWords(SecurityConstants.FROM_IN);
        return MadpQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
    }



    /**
     * 发送消息提醒
     * @return
     */
    @SneakyThrows
    public String sendNotifications(){
        remoteSensitiveWordsService.sendNotifications(SecurityConstants.FROM_IN);
        return MadpQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
    }

}
